package cn.iocoder.yudao.module.search.api.search.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import java.util.List;
import java.util.Map;

/**
 * RPC 服务 - 搜索查询 Request DTO
 *
 * @author 芋道源码
 */
@Schema(description = "RPC 服务 - 搜索查询 Request DTO")
@Data
public class SearchQueryReqDTO {

    @Schema(description = "星球ID", example = "1001")
    private Long planetId;

    @Schema(description = "索引名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "user_index")
    @NotBlank(message = "索引名称不能为空")
    private String indexName;

    @Schema(description = "查询关键词", example = "张三")
    private String query;

    @Schema(description = "查询字段", example = "[\"name\", \"description\"]")
    private List<String> fields;

    @Schema(description = "过滤条件", example = "{\"age\":{\"gte\":18}}")
    private Map<String, Object> filters;

    @Schema(description = "排序字段", example = "[{\"age\":\"desc\"},{\"_score\":\"desc\"}]")
    private List<Map<String, String>> sorts;

    @Schema(description = "分页页码", example = "1")
    @Min(value = 1, message = "页码必须大于0")
    private Integer pageNo = 1;

    @Schema(description = "分页大小", example = "10")
    @Min(value = 1, message = "分页大小必须大于0")
    private Integer pageSize = 10;

    @Schema(description = "高亮字段", example = "[\"name\", \"description\"]")
    private List<String> highlightFields;

    @Schema(description = "聚合查询", example = "{\"age_stats\":{\"stats\":{\"field\":\"age\"}}}")
    private Map<String, Object> aggregations;

}
